home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Memory / Pools / FinitePool.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  579 b   |  37 lines  |  [TEXT/CWIE]

  1. // FinitePool.h
  2.  
  3. #ifndef FinitePool_h
  4. #define FinitePool_h
  5.  
  6. #ifndef FinitePoolBase_h
  7. #include "FinitePoolBase.h"
  8. #endif
  9. #ifndef AlignedBlock_h
  10. #include "AlignedBlock.h"
  11. #endif
  12. #ifndef BitArray_h
  13. #include "BitArray.h"
  14. #endif
  15.  
  16. template < class Element, uint32 size >
  17. class FinitePool: public FinitePoolBase
  18.   {
  19.     private:
  20.         AlignedBlock< size * sizeof( Element ) > space;
  21.         BitArray< size > map;
  22.     
  23.     public:
  24.         FinitePool()
  25.           : FinitePoolBase( space, map, size )
  26.           {}
  27.         
  28.         void Delete( Element *p )
  29.           {
  30.             Assert( p != 0 );
  31.             p->~Element();
  32.             Release( p );
  33.           }
  34.   };
  35.  
  36. #endif
  37.